using YMJake.Flowable.ExternalWorker.Client.Core.Client;

namespace YMJake.Flowable.ExternalWorker.Client.AspNetCore.Pipeline;

/// <summary>
/// Context for worker pipeline execution
/// </summary>
public interface IWorkerPipelineContext
{
    /// <summary>
    /// The acquired external worker job
    /// </summary>
    IAcquiredExternalWorkerJob Job { get; }

    /// <summary>
    /// The topic this worker is handling
    /// </summary>
    string Topic { get; }

    /// <summary>
    /// The worker ID
    /// </summary>
    string WorkerId { get; }

    /// <summary>
    /// Service provider for dependency injection
    /// </summary>
    IServiceProvider ServiceProvider { get; }

    /// <summary>
    /// Result builder for creating work results
    /// </summary>
    IWorkResultBuilder ResultBuilder { get; }

    /// <summary>
    /// The result of the worker execution (set by handlers)
    /// </summary>
    WorkerResult? Result { get; set; }

    /// <summary>
    /// Additional properties for passing data between middleware
    /// </summary>
    IDictionary<string, object?> Properties { get; }

    /// <summary>
    /// Cancellation token for the operation
    /// </summary>
    CancellationToken CancellationToken { get; }
}